﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace JZ.Common
{
    public static class FolderHelper
    {
        public static string CreateRandonFolder(long id, string baseFolder, bool createPath = false)
        {
            string mainString = id.ToString();
            string retValue = string.Empty;
            for (int i = 0; i < 10 && i < mainString.Length; i++)
            {
                retValue += mainString[i] + "\\";
            }

            string fullFolder = Path.Combine(baseFolder, retValue);
            if (createPath)
            {
                if (!Directory.Exists(fullFolder))
                {
                    Directory.CreateDirectory(fullFolder);
                }
            }
            return fullFolder;
        }
    }
}
